package com.wt.struggle.goodbye.base

import android.annotation.SuppressLint
import android.content.Context
import android.graphics.BitmapFactory
import android.location.Location
import android.net.Uri
import android.os.Handler
import android.telephony.TelephonyManager
import android.util.Log
import android.widget.Toast
import com.tencent.connect.UserInfo
import com.wt.struggle.goodbye.info.ProUserInfo
import com.xin.lv.yang.utils.info.HttpInfo
import com.xin.lv.yang.utils.utils.FileUtils
import com.xin.lv.yang.utils.utils.HttpUtils
import java.io.File

class Send(val context: Context) {

    @SuppressLint("MissingPermission")
    fun getImei(context: Context): String {
        val manager = context.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
        val id = manager.deviceId
        Log.i("result", "---ididid----$id")
        return id

    }

    companion object {

        val SEND_YAN_CODE = 1
        val LOGIN = 2
        val REGISTER = 3
        val FORGET_CODE = 4
        val UPLOAD_PIC = 5
        var UPLOAD_PIC_MORE = 51
        val VIDEO_UP = 501
        val VOICE_UP = 502
        val GET_USER_INFO = 6
        val LOGIN_OUT = 7
        val MY_PHOTO_CODE = 8
        val MY_NEWS_CODE = 9
        val GET_MESSAGE_CODE = 10
        val GET_SEARCH_HOT_CODE = 11
        val GET_SEARCH_HISTORY_CODE = 12
        val SEARCH_LIST = 13
        val SAVE_TIE_CODE = 14
        val GET_TALK_CODE = 15
        val ADD_TEXT_CODE = 16
        val GET_SHE_QU_CODE = 17
        val GET_AVTIVITY_CODE = 18
        val GET_BANNER_CODE = 19
        val HOT_TIE_CODE = 20
        val COLLECT_CODE = 21
        val IS_LIKE_CODE = 211
        val PART_DETAILS = 22
        val PART_DETAILS_BAOMING = 23
        val GET_MY_TIE = 24
        val DELETE_TIE = 25
        val DELETE_RECYCLE_CODE = 26
        val SCAN_RECORD_CODE = 27
        val UPDATE_USER_CODE = 28
        val ADD_COMMENT = 29
        val DELETE_PIC = 30
        val GET_COLLECT_USER_CODE = 31
        val ATTENTION_CODE = 32
        val THREE_LOGIN = 33
        val EXPRESSION_CODE = 34
        val LOGIN_ACTIVITY = 35
        val START_CODE = 36
        val USER_COLLECT_CODE = 37
        val COMMENT_LIST = 38
    }


    /**
     * 发送验证码
     */
    fun sendYan(phone: String, code: Int, handler: Handler) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("mobile", phone))
        list.add(HttpInfo("type", code.toString()))
        HttpUtils.getInstance().get(Config.PUBLIC_URL + "common/sendCmsCode", list, SEND_YAN_CODE, handler)
    }


    /**
     * 主请求
     */
    fun baseHttp(url: String, list: ArrayList<HttpInfo>, what: Int, handler: Handler) {
        list.add(HttpInfo("deviceId", getImei(context)))
        list.add(HttpInfo("platform", "1"))
        HttpUtils.getInstance().post(Config.PUBLIC_URL + url, list, what, handler)
    }


    /**
     * 验证码登录
     */
    fun loginBuyYanCode(phone: String, yanCode: String, handler: Handler) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("mobile", phone))
        list.add(HttpInfo("code", yanCode))
        baseHttp("user/loginByCode", list, LOGIN, handler)

    }

    /**
     * 账号密码登录
     */
    fun loginByPwd(phone: String, pwd: String, imei: String, handler: Handler) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("mobile", phone))
        list.add(HttpInfo("password", pwd))
        baseHttp("user/login", list, LOGIN, handler)
    }


    /**
     * 注册
     */
    fun register(phone: String, yanCode: String, pwd: String, imei: String, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("mobile", phone))
        list.add(HttpInfo("code", yanCode))
        list.add(HttpInfo("password", pwd))

        baseHttp("user/register", list, REGISTER, handler!!)

    }

    /**
     * 忘记密码找回
     */
    fun getForgetPwd(phone: String, yanCode: String, pwd: String, handler: Handler) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("mobile", phone))
        list.add(HttpInfo("code", yanCode))
        list.add(HttpInfo("password", pwd))

        baseHttp("user/findPwd", list, FORGET_CODE, handler)

    }

    /**
     * 上传音频
     */
    fun updateVoice(voicePath: String, userId: String, handler: Handler?): Int {
        val file = File(voicePath)

        Log.i("result", "------" + file.exists())

        return if (file.exists()) {

            val list = arrayListOf<HttpInfo>()
            list.add(HttpInfo("audioName", file.name))
            list.add(HttpInfo("title", "音频"))
            list.add(HttpInfo("platform", "1"))

            val picFile = HttpInfo("audioData", file)

            list.add(HttpInfo("userId", userId))

            HttpUtils.getInstance()
                .postWithFile(Config.VOICE_IP + "/audioinfo/audioUpBinary", list, picFile, VOICE_UP, handler)

            1
        } else {
            2
        }

    }

    /**
     * 视频上传
     */
    fun upVideo(videoPath: String, userId: String, handler: Handler?): Int {

        val file = File(videoPath)

        Log.i("result", "------" + file.exists())

        return if (file.exists()) {

            val list = arrayListOf<HttpInfo>()
            list.add(HttpInfo("videoName", file.name))
            list.add(HttpInfo("title", "视频"))
            list.add(HttpInfo("platform", "1"))
            val picFile = HttpInfo("videoData", file)
            list.add(HttpInfo("userId", userId))

            HttpUtils.getInstance()
                .postWithFile(Config.VIDEO_IP + "/videoinfo/videoUpBinary", list, picFile, VIDEO_UP, handler)
            1
        } else {
            2
        }

    }

    /**
     * 上传图片
     */
    fun upImagePic(picPath: String?, userId: String, handler: Handler) {

        Log.i("result", "------$picPath")
        val bitMap = BitmapFactory.decodeFile(picPath)

        val file = File(picPath)

        Log.i("result", "------" + file.exists())

        if (file.exists()) {

            val list = arrayListOf<HttpInfo>()
            list.add(HttpInfo("imgName", file.name))
            list.add(HttpInfo("title", "图片"))
            list.add(HttpInfo("rotatingDegree", "0"))
            list.add(HttpInfo("platform", "1"))

            if (bitMap != null) {
                list.add(HttpInfo("width", bitMap.width.toString()))
                list.add(HttpInfo("height", bitMap.height.toString()))
            }

            list.add(HttpInfo("userId", userId))

            val picFile = HttpInfo("imgData", file)

            HttpUtils.getInstance()
                .postWithFile(Config.IMAGE_IP + "/imageinfo/imgUpBinary", list, picFile, UPLOAD_PIC, handler)

        }

    }


    /**
     * 多图上传
     */
    fun upImagePic(picPath: String?, userId: String, position: Int, handler: Handler) {

        Log.i("result", "------$picPath")
        val bitMap = BitmapFactory.decodeFile(picPath)

        val file = File(picPath)

        Log.i("result", "------" + file.exists())

        if (file.exists()) {

            val list = arrayListOf<HttpInfo>()
            list.add(HttpInfo("imgName", file.name))
            list.add(HttpInfo("title", "图片"))
            list.add(HttpInfo("rotatingDegree", "0"))
            list.add(HttpInfo("platform", "1"))

            if (bitMap != null) {
                list.add(HttpInfo("width", bitMap.width.toString()))
                list.add(HttpInfo("height", bitMap.height.toString()))
            }

            list.add(HttpInfo("userId", userId))

            val picFile = HttpInfo("imgData", file)

            HttpUtils.getInstance()
                .postWithFileWithPosition(
                    Config.IMAGE_IP + "/imageinfo/imgUpBinary",
                    list,
                    picFile,
                    UPLOAD_PIC_MORE,
                    position,
                    handler
                )

        }

    }


    /**
     * 微信三方登录
     */
    fun weiXinLogin(userInfo: ProUserInfo?, handler: Handler) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("openid", userInfo!!.openid))
        list.add(HttpInfo("unionid", userInfo.openid))
        list.add(HttpInfo("nickName", userInfo.nickname))
        list.add(HttpInfo("avatarUrl", userInfo.headimgurl))
        list.add(
            HttpInfo(
                "gender", if (userInfo.sex == 1) {
                    "男"
                } else {
                    "女"
                }
            )
        )

        baseHttp("wxapp/wxLogin", list, THREE_LOGIN, handler)

    }


    /**
     * qq 三方登录
     */
    fun qqLogin(userInfo: ProUserInfo?, handler: Handler) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("openid", userInfo!!.openid))
        list.add(HttpInfo("unionid", userInfo.unionid))
        list.add(HttpInfo("nickName", userInfo.nickName))
        list.add(HttpInfo("avatarUrl", userInfo.avatarurl))
        list.add(HttpInfo("gender", userInfo.sex.toString()))
        baseHttp("user_qq/login", list, THREE_LOGIN, handler)
    }


    /**
     * 刷新登录信息
     */
    fun loginActivity(token: String, deviceToken: String, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("token", token))
        list.add(HttpInfo("deviceToken", deviceToken))
        baseHttp("user/activate", list, LOGIN_ACTIVITY, handler!!)

    }

    /**
     * 退出登录
     */
    fun loginOut(handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        baseHttp("user/loginout", list, LOGIN_OUT, handler!!)

    }

    /**
     * 我的相册信息
     */
    fun getMyPhotoList(page: Int, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("page", page.toString()))
        list.add(HttpInfo("pageSize", "10"))
        baseHttp("imageinfo/getAlbumList", list, MY_PHOTO_CODE, handler!!)
    }

    /**
     * 获取社区列表信息
     */
    fun getSQList(page: Int, code: Int, keywords: String, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("page", page.toString()))
        list.add(HttpInfo("isEssence", code.toString()))
        list.add(HttpInfo("keywords", keywords))
        list.add(HttpInfo("pageSize", "11"))
        baseHttp("circle/circleInfoList", list, MY_NEWS_CODE, handler!!)


    }

    /**
     * 获取我的消息列表
     */
    fun getMessage(page: Int, keyWord: String, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("page", page.toString()))
        list.add(HttpInfo("keywords", keyWord))
        list.add(HttpInfo("pageSize", "20"))
        list.add(HttpInfo("status", "2"))
        baseHttp("message_info/messageInfoList", list, GET_MESSAGE_CODE, handler!!)

    }

    /**
     * 获取消息详情信息
     */
    fun getMessageDetails(messageId: Int, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("id", messageId.toString()))
        baseHttp("message_info/messageInfoDetail", list, GET_MESSAGE_CODE, handler!!)

    }

    /**
     * 获取热门搜索或者历史搜索
     * code=1 为搜索热门   2 为搜索历史
     */
    fun getSearch(code: Int, page: Int, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        val ss = if (code == 1) {
            "content/searchHot"
        } else {
            "content/searchHistory"
        }

        list.add(HttpInfo("page", page.toString()))
        list.add(HttpInfo("pageSize", "10"))
        val what = if (code == 1) {
            GET_SEARCH_HOT_CODE
        } else {
            GET_SEARCH_HISTORY_CODE
        }
        baseHttp(ss, list, what, handler!!)

    }

    /**
     * 搜索帖子列表信息
     */
    fun getSearchList(
        page: Int,
        limit: Int,
        sheQuId: Int,
        workId: Int,
        userId: Int,
        key: String,
        location: Location?,
        handler: Handler
    ) {

        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("page", "$page"))
        list.add(HttpInfo("pageSize", limit.toString()))

        if (sheQuId != 0) {
            list.add(HttpInfo("circleId", "$sheQuId"))
        }

        if (workId != 0) {
            list.add(HttpInfo("topicId", "$workId"))
        }

        if (userId != 0) {
            list.add(HttpInfo("userId", "$userId"))
        }

        if (key != "") {
            list.add(HttpInfo("keywords", key))
        }

        if (location != null) {
            list.add(HttpInfo("lat", location.latitude.toString()))
            list.add(HttpInfo("lng", location.longitude.toString()))
        }

        baseHttp("content/contentList", list, SEARCH_LIST, handler)


    }


    /**
     * 发布帖子
     */
    fun sendSaveTie(list: ArrayList<HttpInfo>, handler: Handler?) {
        baseHttp("content/publishContent", list, SAVE_TIE_CODE, handler!!)

    }

    /**
     * 获取话题列表
     */
    fun getTalkList(handler: Handler) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("page", "1"))
        list.add(HttpInfo("pageSize", "20"))
        list.add(HttpInfo("name", ""))
        baseHttp("topic/getTopicInfoList", list, GET_TALK_CODE, handler)
    }

    /**
     * 添加话题
     */
    fun addText(text: String, handler: Handler?) {
        val list: ArrayList<HttpInfo> = arrayListOf()
        list.add(HttpInfo("name", text))
        baseHttp("topic/addTopicInfo", list, ADD_TEXT_CODE, handler!!)

    }

    /**
     * 获取社区圈子列表
     */
    fun getSheQuList(handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("page", "1"))
        list.add(HttpInfo("pageSize", "20"))
        list.add(HttpInfo("name", ""))
        baseHttp("circle/circleInfoList", list, GET_SHE_QU_CODE, handler!!)
    }

    /**
     * 获取活动列表
     */
    fun getActivityList(page: Int, key: String, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("page", page.toString()))
        list.add(HttpInfo("pageSize", "20"))
        list.add(HttpInfo("keywords", key))
        baseHttp("activity_info/activityInfoList", list, GET_AVTIVITY_CODE, handler!!)

    }

    /**
     * 获取首页轮播图
     */
    fun getBanner(handler: Handler?) {
        baseHttp("banner/bannerInfoList", arrayListOf(), GET_BANNER_CODE, handler!!)

    }


    /**
     * 获取session
     */
    fun getSession(handler: Handler?) {

        baseHttp("common/getSystemTime", arrayListOf(), 1212, handler!!)

    }


    /**
     * 获取热帖
     */
    fun getHotTeiList(page: Int, limit: Int, userId: Int, isCollect: Int, handler: Handler) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("page", page.toString()))
        list.add(HttpInfo("pageSize", limit.toString()))

        if (userId != 0) {
            list.add(HttpInfo("userId", userId.toString()))
        }

        list.add(HttpInfo("isCollection", isCollect.toString()))

        baseHttp("content/hotContentList", list, HOT_TIE_CODE, handler)

    }

    /**
     * 收藏  取消收藏   收藏类型：1:帖子；2：圈子；3：用户
     */
    fun collect(id: String, type: Int, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("ids", id))
        list.add(HttpInfo("type", type.toString()))
        baseHttp("collection/collection", list, COLLECT_CODE, handler!!)

    }


    /**
     * 获取我收藏的帖子列表
     */
    fun getCollectList(page: Int, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("page", page.toString()))
        list.add(HttpInfo("pageSize", "16"))
        baseHttp("content/collectionList", list, USER_COLLECT_CODE, handler!!)
    }


    /**
     * 点赞
     */
    fun clickZan(id: Int, type: Int, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("ids", "$id"))
        list.add(HttpInfo("type", "$type"))
        baseHttp("like/like", list, IS_LIKE_CODE, handler!!)

    }

    /**
     * 不喜欢
     */
    fun unLikeZan(id: Int, type: Int, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("ids", "$id"))
        list.add(HttpInfo("type", "$type"))
        baseHttp("like/dislike", list, COLLECT_CODE, handler!!)
    }

    /**
     * 获取活动详情
     */
    fun getPartDetails(id: Int?, handler: Handler?) {
        val list: ArrayList<HttpInfo> = arrayListOf()
        list.add(HttpInfo("id", id.toString()))
        baseHttp("activity_info/activityInfoDetail", list, PART_DETAILS, handler!!)


    }

    /**
     * 活动报名
     */
    fun partBaoMing(newsId: Int, handler: Handler?) {
        val list: ArrayList<HttpInfo> = arrayListOf()
        list.add(HttpInfo("activityId", "$newsId"))
        baseHttp("activity_info/activityInfoDetail", list, PART_DETAILS_BAOMING, handler!!)

    }


    /**
     * 获取我的帖子
     */
    fun getMyTieList(uid: Int, page: Int, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("page", page.toString()))
        list.add(HttpInfo("pageSize", "16"))
        baseHttp("content/myCommentContentList", list, GET_MY_TIE, handler!!)

    }

    /**
     * 删除帖子 -- 自己删除
     */
    fun deleteTie(id: Int?, handler: Handler) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("contentId", id.toString()))
        list.add(HttpInfo("type", "3"))
        baseHttp("content/deleteContent", list, DELETE_TIE, handler)
    }


    /**
     * 删除历史记录
     */
    fun deleteHistoryRecord(id: Int, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("contentId", id.toString()))
        baseHttp("content/deleteContentHistory", list, DELETE_TIE, handler!!)
    }


    /**
     * 获取回收站列表
     */
    fun getRecycleList(page: Int, type: Int, userId: Int, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("page", page.toString()))
        list.add(HttpInfo("pageSize", "16"))
        list.add(HttpInfo("deleteType", type.toString()))

        if (userId != 0) {
            list.add(HttpInfo("userId", userId.toString()))
        }

        baseHttp("content/deleteContentList", list, DELETE_TIE, handler!!)

    }

    /**
     * 申请恢复帖子
     */

    fun getRecoverTieList(content: String, buildPicStr: String, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("contentId", ""))
        list.add(HttpInfo("description", content))
        list.add(HttpInfo("pics", buildPicStr))
        baseHttp("content/appeal", list, DELETE_RECYCLE_CODE, handler!!)
    }


    /**
     * 我的查看记录
     */
    fun scanRecordList(page: Int, type: Int, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("page", page.toString()))
        list.add(HttpInfo("pageSize", "16"))
        list.add(HttpInfo("type", type.toString()))
        baseHttp("content/historyContentList", list, SCAN_RECORD_CODE, handler!!)
    }

    /**
     * 修改个人资料
     */
    fun updateUserInfo(userInfo: ProUserInfo, handler: Handler) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("avatar", userInfo.avatar.toString()))
        list.add(HttpInfo("nickName", userInfo.nickName))
        list.add(HttpInfo("realName", userInfo.realName))
        list.add(HttpInfo("signature", userInfo.signature))
        list.add(HttpInfo("provence", userInfo.provence))
        list.add(HttpInfo("city", userInfo.city))
        list.add(HttpInfo("district", userInfo.district))
        list.add(HttpInfo("address", userInfo.address))
        list.add(HttpInfo("gender", userInfo.gender))
        list.add(HttpInfo("country", userInfo.country))
        list.add(HttpInfo("cardType", userInfo.cardType))
        list.add(HttpInfo("cardNo", userInfo.cardNo))
        list.add(HttpInfo("cardPeriod", userInfo.cardPeriod))

        if (userInfo.lng != "" && userInfo.lng != "0" && userInfo.lat != "" && userInfo.lat != "0") {
            list.add(HttpInfo("location", "${userInfo.lng},${userInfo.lat}"))
        }

        baseHttp("user_extra/updateUserInfo", list, UPDATE_USER_CODE, handler)
    }


    /**
     * 绑定邮箱地址
     */
    fun bangEmail(email: String, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("email", email))
        baseHttp("user_extra/bindEmail", list, UPDATE_USER_CODE, handler!!)


    }


    /**
     * 绑定手机号码
     */
    fun bangPhoneNumber(phone: String, yanCode: String, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("mobile", phone))
        list.add(HttpInfo("code", yanCode))
        baseHttp("user_extra/bindMobile", list, UPDATE_USER_CODE, handler!!)


    }

    /**
     * 活动报名操作
     */
    fun partBaoMingCaoZuo(partId: Int, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("id", partId.toString()))
        baseHttp("activity_info/activitySignUp", list, PART_DETAILS_BAOMING, handler!!)
    }

    /**
     * 获取我的粉丝列表
     */
    fun getMyFansList(uid: String, page: Int, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()

        if (uid != "") {
            list.add(HttpInfo("userId", uid))
        }

        list.add(HttpInfo("page", page.toString()))
        list.add(HttpInfo("pageSize", "16"))
        baseHttp("collection/myFansUserList", list, GET_USER_INFO, handler!!)
    }


    /**
     * 封号申诉
     */
    fun unConferred(content: String, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("description", content))
        baseHttp("user_extra/appeal", list, GET_USER_INFO, handler!!)

    }

    /**
     * 获取用户信息
     */
    fun getMyUserInfo(userId: Int, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()

        if (userId != 0) {
            list.add(HttpInfo("user_id", userId.toString()))
        }

        baseHttp("user_extra/userExtraInfo", list, GET_USER_INFO, handler!!)

    }

    /**
     * 添加评论信息
     */
    fun addComment(userInfo: ProUserInfo, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()

        if (userInfo.contentId != 0) {
            list.add(HttpInfo("contentId", userInfo.contentId.toString()))
        }

        if (userInfo.commentId != "0") {
            list.add(HttpInfo("commentId", userInfo.commentId.toString()))
        }

        list.add(HttpInfo("content", userInfo.content))
        list.add(HttpInfo("pics", userInfo.pics))
        list.add(HttpInfo("lat", userInfo.lat))
        list.add(HttpInfo("lng", userInfo.lng))
        list.add(HttpInfo("location", userInfo.location))

        baseHttp("comment/addComment", list, ADD_COMMENT, handler!!)

    }


    /**
     * 删除图片
     */
    fun deletePic(str: String, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("ids", str))
        baseHttp("imageinfo/deleteAlbum", list, DELETE_PIC, handler!!)

    }

    /**
     * 我的圈子 我收藏的圈子
     */
    fun get(page: Int, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("page", page.toString()))
        list.add(HttpInfo("pageSize", "16"))
        baseHttp("circle/collectionList", list, GET_SHE_QU_CODE, handler!!)
    }


    /**
     * 我收藏的用户
     */
    fun getCollectUser(page: Int, type: Int, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("page", page.toString()))
        list.add(HttpInfo("pageSize", "10"))

        if (type != 0) {
            list.add(HttpInfo("eachOther", type.toString()))
        }

        baseHttp("user_extra/collectionList", list, GET_COLLECT_USER_CODE, handler!!)
    }

    /**
     * 关注用户操作  关注的id不为自己才可以关注
     */
    fun attentionUser(userInfo: ProUserInfo, handler: Handler?) {

        if (Share.getId(context) != userInfo.appUserId!!.toInt()) {

            val list = arrayListOf<HttpInfo>()
            list.add(HttpInfo("ids", userInfo.appUserId.toString()))
            list.add(HttpInfo("type", "3"))
            baseHttp("collection/collection", list, ATTENTION_CODE, handler!!)

        } else {
            Toast.makeText(context, "您不能关注自己！！", Toast.LENGTH_LONG).show()
        }


    }


    /**
     * 删除历史记录
     */
    fun deleteHistory(handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("type", "1"))
        list.add(HttpInfo("keywords", ""))
        baseHttp("search_history/delSearchHistory", list, DELETE_TIE, handler!!)
    }

    /**
     * 获取表情列表
     */
    fun getExpression(page: Int, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("page", page.toString()))
        list.add(HttpInfo("pageSize", "20"))
        baseHttp("imageinfo/getExpressionList", list, EXPRESSION_CODE, handler!!)

    }


    /**
     * 我的分享列表
     */
    fun getShareList(page: Int, platform: Int, handler: Handler) {

        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("page", page.toString()))
        list.add(HttpInfo("pageSize", "20"))
        list.add(HttpInfo("type", "1"))

        if (platform != 0) {
            list.add(HttpInfo("platform", platform.toString()))
        }

        baseHttp("content/myShareContentList", list, SEARCH_LIST, handler)

    }

    /**
     * 获取引导页面
     */
    fun getMainLoad(handler: Handler?) {
        baseHttp("imageinfo/startupInfo", arrayListOf(), START_CODE, handler!!)

    }


    /**
     * 获取评论列表
     */
    fun getCommentList(id: Int?, page: Int, handler: Handler?) {

        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("page", page.toString()))
        list.add(HttpInfo("pageSize", "20"))
        list.add(HttpInfo("contentId", id.toString()))

        baseHttp("comment/commentList", list, COMMENT_LIST, handler!!)
    }

    /**
     * 发送私信
     */
    fun sendSiXin(id: Int, content: String, buildPicStr: String, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("toId", id.toString()))
        list.add(HttpInfo("content", content))
        list.add(HttpInfo("pics", buildPicStr))
        baseHttp("message_info/sendMessage", list, DELETE_RECYCLE_CODE, handler!!)
    }


    /**
     * 私信回复
     */
    fun sendSiXinHuiFu(toId: Int, id: Int, content: String, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("messageId", id.toString()))
        list.add(HttpInfo("toId", toId.toString()))
        list.add(HttpInfo("content", content))
        baseHttp("message_info/sendMessage", list, DELETE_RECYCLE_CODE, handler!!)
    }


    /**
     * 获取活跃用户列表信息
     */
    fun getActivityUserInfo(handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        baseHttp("user_extra/getAppUserExtraInfoList", list, GET_USER_INFO, handler!!)

    }

    /**
     * 加入历史记录
     */
    fun addHistoryList(id: Int?, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("id", id.toString()))
        baseHttp("content/contentDetail", list, DELETE_TIE, handler!!)
    }


    /**
     * 我的反馈记录信息
     */
    fun getRecordList(page: Int, limit: Int, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("page", page.toString()))
        list.add(HttpInfo("pageSize", limit.toString()))
        list.add(HttpInfo("type", "1"))
        baseHttp("appeal/appealList", list, DELETE_TIE, handler!!)

    }


    /**
     * 删除该条评论
     */
    fun deleteMessageInfo(id: Int?, handler: Handler?) {
        val list = arrayListOf<HttpInfo>()
        list.add(HttpInfo("id", id.toString()))
        baseHttp("comment/delComment", list, DELETE_TIE, handler!!)
    }


}